//
//  ViewController.m
//  5.3Homework
//
//  Created by dllo on 16/6/3.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ViewController.h"
#import "CustomView.h"
@interface ViewController ()

@end

@implementation ViewController
- (void)dealloc{
    
    [super dealloc];
    
    
}
- (instancetype)init{
    
    self = [super init];
    if (self)
    {
        NSLog(@"%s, %d", __FUNCTION__, __LINE__);
    }
    
    return self;
}

- (void)loadView{
    
    [super loadView];
    
    
    
}





- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    [self createSubViews];
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    
}

- (void)viewDidAppear:(BOOL)animated{
    
    [super viewDidAppear:animated];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
    
    // Dispose of any resources that can be recreated.
}


- (void)createSubViews{
//    1.命名 view1 ~ view5
//    2.分别设置背景颜色红、黄、绿、蓝、灰
//    3.位置与大小自定义。
//    4.设置UIView常用属性。(数据自定)
//    CustomView *View1 = [CustomView customViewWithFrame:CGRectMake(10, 10, 100, 100) Color:[UIColor redColor]];
//    CustomView *View2 = [CustomView customViewWithFrame:CGRectMake(90, 90, 100, 100) Color:[UIColor yellowColor]];
//    CustomView *View3 = [CustomView customViewWithFrame:CGRectMake(170, 170, 100, 100) Color:[UIColor greenColor]];
//    CustomView *View4 = [CustomView customViewWithFrame:CGRectMake(250, 250, 100, 100) Color:[UIColor blueColor]];
//    CustomView * View5 = [CustomView customViewWithFrame:CGRectMake(330, 330, 100, 100) Color:[UIColor grayColor]];
//    View1.tag = 100;
//    View2.tag = 200;
//    View3.tag = 300;
//    View4.tag = 400;
//    View5.tag = 500;
//    [self.view addSubview:View1];
//    [View1 release];
//    [self.view addSubview:View2];
//    [View2 release];
//    [self.view addSubview:View3];
//    [View3 release];
//    [self.view addSubview:View4];
//    [View4 release];
//    [self.view addSubview:View5];
//    [View5 release];
    
    self.view.alpha = 0.5;
    CustomView *view1 = [CustomView customViewWithFrame:CGRectMake(50, 90, 100, 50) Color:[UIColor cyanColor]];
    [self.view addSubview:view1];
    [view1 release];
    
    CustomView *view2 = [CustomView customViewWithFrame:CGRectMake(50, 170, 100, 50) Color:[UIColor cyanColor]];
    [self.view addSubview:view2];
    [view2 release];
    
    CustomView *view3 = [CustomView customViewWithFrame:CGRectMake(190, 90, 200, 50) Color:[UIColor cyanColor]];
    [self.view addSubview:view3];
    [view3 release];
    
    CustomView *view4 = [CustomView customViewWithFrame:CGRectMake(190, 170, 200, 50) Color:[UIColor cyanColor]];
    [self.view addSubview:view4];
    [view4 release];
    
    CustomView *view5 = [CustomView customViewWithFrame:CGRectMake(70, 250, 80, 50) Color:[UIColor cyanColor]];
    [self.view addSubview:view5];
    [view5 release];
    
    CustomView *view6 = [CustomView customViewWithFrame:CGRectMake(290, 250, 80, 50) Color:[UIColor cyanColor]];
    [self.view addSubview:view6];
    [view6 release];
}






@end
